import http from "@/utils/http";

export const loginApi = (loginForm) => {
  return http.get("sys/sysUser/login", {
    params: {
      userAccount: loginForm.userAccount,
      userPassword: loginForm.userPassword,
    },
  });
};

export const getMenuTreeByIdApi = () => {
  return http.get("sys/sysUser/getMenuTreeById");
}


export const getPageApi = (queryPageParams) => {
  return http({
    url: "sys/sysUser/getPage",
    method: "GET",
    params:queryPageParams
  })
}

export const updateUserStateApi = (id) => {
  return http({
    url: "sys/sysUser/updateUserState",
    method: "POST",
    params:{
      id
    }
  })
}

export const getByIdApi = (id) => {
  return http({
    url: "sys/sysUser/getById",
    method: "GET",
    params:{
      id
    }
  })
}

export const getTreeApi = () => {
  return http({
    url: "sys/sysDept/getTree",
    method: "GET",
  })
}

export const saveApi = (form) => {
  return http({
    url: "sys/sysUser/save",
    method: "PUT",
    data: form
  })
}

export const updateApi = (form) => {
  return http({
    url: "sys/sysUser/update",
    method: "POST",
    data: form
  })
}

export const delApi = (ids) => {
  console.log(ids)
  return http({
    url: "sys/sysUser/del?ids="+ids,
    method: "DELETE"
  })
}
